#include "TcpServer.hpp"
#include "Commandexec.hpp"

// ./server_tcp localport
int main(int argc, char *argv[])
{   
    if(argc != 2)
    {
        std::cerr << "Usage: " << argv[0] << " localport" << std::endl;
        return 3;
    }

    //std::string ip = argv[1];
    uint16_t port = std::stoi(argv[1]);

    Command cmd;
    std::unique_ptr<TcpServer> svr_uptr = std::make_unique<TcpServer>([&cmd](std::string command){
        return cmd.Execute(command);
    }, port);
    
    svr_uptr->InitServer();
    svr_uptr->Start();

    return 0;
}